package Kafka_model_game

import java.sql.{Connection, DriverManager}

object myConn {
	private var connection:Connection=null
	private val driver="com.mysql.cj.jdbc.Driver"
	private val url="jdbc:mysql://localhost:3306/fp?useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&characterEncoding=utf-8"
	private val username="root"
	private val password="admin"

	def conn():Connection={
		if (connection==null){
			print(this.driver)
			Class.forName(this.driver)
			try{
				connection=DriverManager.getConnection(url,username,password)
			}catch {
				case e:Exception => println(e.getMessage+"----"+e.getCause)
			}
		}
		connection
	}

}
